<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>宝鉴汇App下载</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
      body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          sans-serif;
        background-color: #f8f8f8;
        margin: 0;
        padding: 0;
      }

      .container {
        max-width: 500px;
        margin: 0 auto;
        padding: 20px;
        text-align: center;
      }

      .logo {
        margin: 30px 0;
      }

      .logo img {
        width: 120px;
        height: 120px;
      }

      .app-info h1 {
        color: #333;
        margin-bottom: 10px;
      }

      .app-info p {
        color: #666;
        font-size: 16px;
      }

      .download-section {
        margin: 40px 0;
      }

      .download-btn {
        display: block;
        width: 80%;
        max-width: 300px;
        margin: 0 auto 20px;
        padding: 16px;
        background: #07c160;
        color: white;
        text-align: center;
        text-decoration: none;
        border-radius: 8px;
        font-size: 18px;
        font-weight: 500;
      }

      .download-btn.secondary {
        background: #1075e8;
      }

      .wechat-guide {
        display: none;
        background: #fff3cd;
        border: 1px solid #ffeaa7;
        border-radius: 8px;
        padding: 20px;
        margin: 20px;
      }

      .wechat-guide p {
        margin: 0;
        color: #856404;
        font-size: 14px;
        line-height: 1.5;
      }

      .wechat-guide img {
        width: 200px;
        margin: 10px 0;
      }

      /* 新增样式 */
      .guide-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 9999;
        display: none;
        justify-content: center;
        align-items: flex-start;
        padding-top: 50px;
      }

      .guide-popup {
        background: white;
        border-radius: 10px;
        padding: 20px;
        text-align: center;
        max-width: 300px;
        margin: 0 20px;
      }

      .arrow-guide {
        position: absolute;
        right: 20px;
        top: 20px;
        width: 100px;
        height: 100px;
        background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M20,20 L80,20 L80,80" fill="none" stroke="white" stroke-width="5"/></svg>')
          no-repeat;
        background-size: contain;
      }

      .close-btn {
        margin-top: 15px;
        padding: 8px 20px;
        background: #07c160;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="app-info">
        <h1>宝鉴汇App</h1>
        <!-- <p>为您提供优质的商品服务</p> -->
      </div>

      <div class="download-section">
        <a href="#" id="mainDownloadBtn" class="download-btn">立即下载</a>
      </div>

      <div id="wechatGuide" class="wechat-guide">
        <p>检测到您正在微信中打开页面</p>
        <p>请点击右上角菜单，选择"在浏览器中打开"以完成下载</p>
      </div>
    </div>

    <!-- 新增引导弹窗 -->
    <div id="guideOverlay" class="guide-overlay">
      <div class="guide-popup">
        <div class="arrow-guide"></div>
        <h3>重要提示</h3>
        <p>请点击右上角菜单</p>
        <p>选择"在浏览器中打开"</p>
        <p>即可正常下载App</p>
        <button class="close-btn" id="closeGuide">我知道了</button>
      </div>
    </div>

    <script>
      $(document).ready(function () {
        // 检测是否在微信中
        function isWechat() {
          return /MicroMessenger/i.test(navigator.userAgent);
        }

        // 检测设备类型
        function getDeviceType() {
          const userAgent = navigator.userAgent;
          if (userAgent.match(/(iPhone|iPod|iPad)/i)) {
            return "iOS";
          } else if (userAgent.match(/Android/i)) {
            return "Android";
          }
          return "Unknown";
        }

        // 获取下载链接
        function getDownloadUrl(deviceType) {
          const downloadLinks = {
            iOS: "https://apps.apple.com/app/your-app-id", // 替换为你的App Store链接
            Android: "http://www.baojianhui.cc/appUrl/bao.apk", // 替换为你的apk下载链接
          };
          return downloadLinks[deviceType] || "#";
        }

        const deviceType = getDeviceType();
        const mainDownloadUrl = getDownloadUrl(deviceType);

        if (isWechat()) {
          // 在微信中，显示指引信息
          $("#mainDownloadBtn").text("请在浏览器中打开");
          $("#mainDownloadBtn").click(function (e) {
            e.preventDefault();
            // 显示全屏引导弹窗
            $("#guideOverlay").css("display", "flex");
          });

          // 关闭引导弹窗
          $("#closeGuide").click(function () {
            $("#guideOverlay").hide();
          });

          // 点击遮罩层也可以关闭
          $("#guideOverlay").click(function (e) {
            if (e.target.id === "guideOverlay") {
              $("#guideOverlay").hide();
            }
          });
        } else {
          // 不在微信中，设置正常下载链接
          $("#mainDownloadBtn").attr("href", mainDownloadUrl);
        }
      });
    </script>
  </body>
</html>
